/* HTML插入按钮样式 - 提高权重防止被覆盖 */
div.html-injector-btn {
  display: inline-block !important;
  margin: 0 4px !important;
  cursor: pointer !important;
  position: relative !important;
  z-index: 999999 !important;
}

div.html-injector-btn .html-btn-container {
  display: flex !important;
  align-items: center !important;
  padding: 6px 12px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  color: white !important;
  font-size: 12px !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

div.html-injector-btn .html-btn-container:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
  transform: translateY(-1px) !important;
}

div.html-injector-btn .html-btn-icon {
  margin-right: 6px !important;
  fill: currentColor !important;
  width: 16px !important;
  height: 16px !important;
}

div.html-injector-btn .html-btn-text {
  font-weight: 500 !important;
  white-space: nowrap !important;
}

/* 模态框样式 - 提高权重 */
div.html-injector-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 999999 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

div.html-injector-modal.show {
  opacity: 1 !important;
  visibility: visible !important;
}

div.html-injector-modal .html-modal-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.5) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
}

div.html-injector-modal .html-modal-content {
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
  width: 100% !important;
  max-width: 900px !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.html-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.html-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.html-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.html-modal-close:hover {
  background: #e9ecef;
  color: #333;
}

.html-modal-body {
  flex: 1;
  padding: 20px 24px;
  overflow: auto;
}

/* 标签页样式 */
.html-tabs {
  display: flex;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 20px;
}

.html-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
}

.html-tab:hover {
  color: #333;
  background: #f8f9fa;
}

.html-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: white;
}

.html-tab-content {
  display: none;
}

.html-tab-content.active {
  display: block;
}

/* HTML格式提示 */
.html-format-tips {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 15px;
  font-size: 13px;
  line-height: 1.4;
}

.html-format-tips strong {
  color: #495057;
}

.tips-toggle {
  background: #007bff;
  color: white;
  border: none;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 10px;
}

.tips-toggle:hover {
  background: #0056b3;
}

.tips-examples {
  margin-top: 10px;
  padding: 10px;
  background: white;
  border-radius: 4px;
  border-left: 3px solid #007bff;
}

.tips-examples p {
  margin: 8px 0 4px 0;
  font-weight: 500;
}

.tips-examples code {
  display: block;
  background: #f8f9fa;
  padding: 8px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  margin-bottom: 10px;
  word-break: break-all;
  border: 1px solid #e9ecef;
}

/* 编辑器样式 */
.html-editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  height: 400px;
}

.html-code-input {
  width: 100%;
  height: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  background: #f8f9fa;
  color: #333;
  transition: border-color 0.2s ease;
}

.html-code-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.html-preview {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  background: white;
  overflow: auto;
  position: relative;
}

.preview-placeholder {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 50px 20px;
}

/* 选项样式 */
.html-options {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.html-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.html-options input[type="checkbox"],
.html-options input[type="radio"] {
  margin: 0;
}

/* 模板网格样式 */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.template-card {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
  background: white;
}

.template-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.template-preview {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.template-preview::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.template-card:hover .template-preview::after {
  opacity: 1;
}

.template-info {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.template-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.template-use-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease;
}

.template-use-btn:hover {
  background: #5a67d8;
}

.template-loading,
.template-error {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

.template-error {
  color: #e53e3e;
}

/* SVG工具样式 */
.svg-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: 400px;
}

.svg-upload {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.svg-upload-btn {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.svg-upload-btn:hover {
  background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.svg-editor {
  flex: 1;
}

.svg-code-input {
  width: 100%;
  height: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  background: #f8f9fa;
  color: #333;
  transition: border-color 0.2s ease;
}

.svg-code-input:focus {
  outline: none;
  border-color: #48bb78;
  box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.svg-preview {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  background: white;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.svg-preview svg {
  max-width: 100%;
  max-height: 100%;
}

/* 底部按钮样式 */
.html-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.html-btn-cancel,
.html-btn-insert {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.html-btn-cancel {
  background: #e9ecef;
  color: #333;
  border-color: #dee2e6;
}

.html-btn-cancel:hover {
  background: #dee2e6;
  border-color: #ced4da;
}

.html-btn-insert {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.html-btn-insert:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .html-modal-content {
    margin: 10px;
    max-height: 95vh;
  }
  
  .html-editor-container,
  .svg-tools {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .html-code-input,
  .svg-code-input {
    height: 200px;
  }
  
  .html-preview,
  .svg-preview {
    height: 150px;
  }
  
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .html-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
} 